import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'

Vue.use(VueRouter)

var router = new VueRouter({
  routes
});

new Vue({
  el: "#app",
  router,
  data() {
    return {
      Animate: ''
    }
  },
  watch: {
    // 监听 $route 为内页设置不同的过渡效果
    "$route"(to, from) {
      const toDepth = to.path.split('/').length
      const fromDepth = from.path.split('/').length
      if (to.path == '/') {
        this.Animate = "slide-right";
      } else if (from.path == '/') {
        this.Animate = "slide-left";
      } else {
        this.Animate = toDepth > fromDepth ? "slide-left" : "slide-right"
      }


    }
  }
}).$mount("#app");
